package com.parktech.sun.domain.model.sunhz;

import com.parktech.sun.domain.model.BaseEntity;
import com.parktech.sun.domain.model.ContentEntity;

import javax.persistence.*;
import java.util.List;

/**
 * User: Think
 * Date: 2010-12-20
 * Time: 1:30:40
 */
@Entity
@DiscriminatorValue("120")
public class Industry extends ContentEntity {

    private IndustryCategory category;

    private List<IndustryAttachment> attachmentList;

    @ManyToOne(fetch = FetchType.EAGER)
    public IndustryCategory getCategory() {
        return category;
    }

    public void setCategory(IndustryCategory category) {
        this.category = category;
    }

    @OneToMany(fetch=FetchType.LAZY, mappedBy = "industry", cascade = CascadeType.ALL)
    public List<IndustryAttachment> getAttachmentList() {
        return attachmentList;
    }

    public void setAttachmentList(List<IndustryAttachment> attachmentList) {
        this.attachmentList = attachmentList;
    }

    @Transient
    public String getLocation() {
        return "industries";
    }
}
